<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui" >

    <body>

        <ui:composition template="/templatePrincipal.xhtml">

            <ui:define name="content">

                <p:panelGrid columns="2">  
                    <f:facet name="header">  
                        Preencher avaliação   
                    </f:facet>  

                    <p:selectOneMenu value="#{preenchimentoM.avaliacaoId}" >
                        <f:ajax event="change" render="@form" execute="@this"    />
                        <f:selectItems value="#{preenchimentoM.listaAvaliacoes}" />
                    </p:selectOneMenu>


                    <f:facet name="footer">  


                        <p:dataTable rendered="#{preenchimentoM.avaliacaoId ne null}" id="Avaliacao" styleClass="dataTable"  var="dt" value="#{preenchimentoM.entidadesPreenchimento}"  rows="25" 
                                     rowKey="#{dt}"  
                                     emptyMessage="Não há registro para serem apresentados">  

                            <p:column  headerText="Pergunta" >  
                                <h:outputText value="#{dt.questao.nome}" styleClass="teste" />  
                            </p:column> 
                            <p:column  headerText="Resposta" >  
                                <p:selectOneRadio id="options" value="#{dt.resposta}">  
                                    <f:selectItem itemLabel="Concordo totalmente" itemValue="1" />  
                                    <f:selectItem itemLabel="Nem concordo,	nem discordo" itemValue="2" />  
                                    <f:selectItem itemLabel="Discordo" itemValue="3" /> 
                                    <f:selectItem itemLabel="Discordo totalmente" itemValue="4" />  
                                    <f:selectItem itemLabel="Não sei avaliar" itemValue="5" />  
                                </p:selectOneRadio>    
                            </p:column> 


                            <f:facet name="footer">
                                <p:commandButton actionListener="#{preenchimentoM.salvaEntidade}"  value="Salvar"
                                                 title="Salvar Avaliacao" />
                                
                                 <p:commandButton actionListener="#{preenchimentoM.salvaEntidade}"  value="Enviar"
                                                 title="Enviar Avaliacao" />
                                
                                <h:commandLink>  
                                    <p:graphicImage value="/images/xml.png" />  
                                    <p:dataExporter type="xml" target="Avaliacao" fileName="dt" pageOnly="true" />  
                                </h:commandLink>  
                                
                                
                               
                                
                            </f:facet>

                        </p:dataTable>







                    </f:facet>  
                </p:panelGrid>  



            </ui:define>           
        </ui:composition>

    </body>
</html>
